//
//  BaseNavigationController.swift
//  SwiftLoopers
//
//  Created by MAC on 2017/8/21.
//  Copyright © 2017年 Kevin. All rights reserved.
//

import UIKit

class BaseNavigationController: BaseWebViewNavigationController,UINavigationControllerDelegate {
    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
        
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationBar.tintColor = UIColor.white
        self.navigationBar.backgroundColor = UIColor.init(red: 108/255.0, green: 184/255.0, blue: 127/255.0, alpha: 1)
        self.navigationBar.barTintColor = UIColor.init(red: 108/255.0, green: 184/255.0, blue: 127/255.0, alpha: 1)
        self.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white, NSFontAttributeName:UIFont.systemFont(ofSize: 18)]
        
        // Do any additional setup after loading the view.
    }
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if self.viewControllers.count > 0 {
            viewController.hidesBottomBarWhenPushed = true;
        }
        super.pushViewController(viewController, animated: true)
    }
    
     func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
        if viewController is BaseViewController {
            let vc = viewController as! BaseViewController
            if vc.isHidenNaviBar {
                vc.navigationController?.setNavigationBarHidden(true, animated: animated)
            }else{
                vc.navigationController?.setNavigationBarHidden(false, animated: animated)
            }
        }
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
